package n1363;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	static boolean a[] =new boolean[1000];
	
	static int b[] =new int[1000];
	
	static int N;
	
	static void solve()
	{
		for(int i=0;i<N;i++)a[i]=false;
		int pos=0;
		for(int j=0;j<N;j++)
		{
			while(pos+1<b[j])
			{
				pos++;
			}
			if(pos+1==b[j]){
				a[pos]=true;
				continue;
			}
			while(pos+1>b[j]&&a[pos])
			{
				pos--;
			}
			if(pos+1==b[j])
			{
				a[pos]=true;
				continue;
			}
			
			System.out.println("No");
			return;
		}
		System.out.println("Yes");
	}
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {

		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		while(true)
		{
			N=Integer.parseInt(bf.readLine());
			if(N==0)break;
			while(true)
			{
				String line=bf.readLine();
				if(line.trim().equals("0"))break;
				StringTokenizer st=new StringTokenizer(line);
				for(int i=0;i<N;i++)
				{
					b[i]=Integer.parseInt(st.nextToken());
				}
				solve();
			}
			System.out.println("");
		}
	}

}
